package com.basics.channel.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.basics.api.response.channel.ChannelMsgListData;
import com.basics.api.response.channel.PostOrMsgData;
import com.basics.channel.entity.CyChannelMsg;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 频道消息 服务类
 * </p>
 *
 * @author WangWei
 * @since 2025-03-09
 */
public interface CyChannelMsgService extends IService<CyChannelMsg> {

    /**
     * 获取频道最后一条消息
     * @param channelId
     * @param userId
     * @return
     */
    PostOrMsgData getLastMsg( Long channelId, Long userId);

    /**
     * 获取未读消息数量
     * @param channelId
     * @param userId
     * @return
     */
    int getUnReadMsgNum(Long channelId,Long userId);

    /**
     * 获取未读消息数量(全部)
     * @param userId
     * @return
     */
    int getUnReadMsgNumByOrganizationId(Long organizationId,Long userId);

    /**
     * 获取频道消息列表
     * @param page
     * @param channelId
     * @param userId
     * @return
     */
    IPage<ChannelMsgListData> selectChannelMsgList(IPage<ChannelMsgListData> page, Long channelId, Long userId);

    /**
     * 发送消息
     * @param msg
     */
    void sendMsg(CyChannelMsg msg);
}
